package com.esri.core.tasks.geocode;

import com.esri.core.geometry.Envelope;
import com.esri.core.geometry.GeometryEngine;
import com.esri.core.geometry.Point;
import com.esri.core.geometry.SpatialReference;
import com.esri.core.internal.tasks.a.d;
import com.github.mikephil.charting.utils.Utils;
import java.util.HashMap;
import java.util.List;

/* loaded from: classes.dex */
public class LocatorFindParameters {
    private static final String BBOX_KEY = "bbox";
    private static final String DISTANCE_KEY = "distance";
    private static final String LOCATION_KEY = "location";
    private static final String MAGIC_KEY_KEY = "magicKey";
    private static final String MAX_LOCATION_KEY = "maxLocations";
    private static final String SOURCE_COUNTRY_KEY = "sourceCountry";
    private static final String TEXT_KEY = "text";
    private double distance;
    private SpatialReference inSR;
    private Point location;
    private String magicKey = null;
    private int maxLocations = 10;
    private List<String> outFields;
    private SpatialReference outSR;
    private Envelope searchExtent;
    private String sourceCountry;
    private String text;

    public LocatorFindParameters(String str) {
        this.text = null;
        this.text = str;
    }

    public String getSourceCountry() {
        return this.sourceCountry;
    }

    public void setSourceCountry(String str) {
        this.sourceCountry = str;
    }

    public SpatialReference getInSR() {
        return this.inSR;
    }

    public Envelope getSearchExtent() {
        return this.searchExtent;
    }

    public void setSearchExtent(Envelope envelope, SpatialReference spatialReference) {
        this.searchExtent = envelope;
        this.inSR = spatialReference;
    }

    public SpatialReference getOutSR() {
        return this.outSR;
    }

    public void setOutSR(SpatialReference spatialReference) {
        this.outSR = spatialReference;
    }

    public List<String> getOutFields() {
        return this.outFields;
    }

    public void setOutFields(List<String> list) {
        this.outFields = list;
    }

    public String getText() {
        return this.text;
    }

    public void setText(String str) {
        this.text = str;
    }

    public int getMaxLocations() {
        return this.maxLocations;
    }

    public void setMaxLocations(int i) {
        this.maxLocations = i;
    }

    public Point getLocation() {
        return this.location;
    }

    public void setLocation(Point point, SpatialReference spatialReference) {
        this.location = point;
        this.inSR = spatialReference;
    }

    public double getDistance() {
        return this.distance;
    }

    public void setDistance(double d) {
        this.distance = d;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void setMagicKey(String str) {
        this.magicKey = str;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public d getParams() {
        d dVar = new d();
        dVar.a = new HashMap();
        dVar.a.put(TEXT_KEY, getText());
        Envelope searchExtent = getSearchExtent();
        if (searchExtent != null && !searchExtent.isEmpty() && getInSR() != null) {
            dVar.a.put(BBOX_KEY, GeometryEngine.geometryToJson(getInSR(), searchExtent));
        }
        if (this.maxLocations > 0) {
            dVar.a.put(MAX_LOCATION_KEY, String.valueOf(this.maxLocations));
        }
        String str = this.sourceCountry;
        if (str != null && str.length() > 0) {
            dVar.a.put(SOURCE_COUNTRY_KEY, getSourceCountry());
        }
        if (this.location != null) {
            dVar.a.put(LOCATION_KEY, GeometryEngine.geometryToJson(getInSR(), this.location));
            if (this.distance > Utils.DOUBLE_EPSILON) {
                dVar.a.put(DISTANCE_KEY, String.valueOf(this.distance));
            }
        }
        if (this.magicKey != null) {
            dVar.a.put(MAGIC_KEY_KEY, this.magicKey);
        }
        dVar.b = getOutFields();
        dVar.c = getOutSR();
        return dVar;
    }

    public String toString() {
        return "LocatorFindParameters [text=" + this.text + ", maxLocations=" + this.maxLocations + ", sourceCountry=" + this.sourceCountry + ", searchExtent=" + this.searchExtent + ", inSR=" + this.inSR + ", location=" + this.location + ", distance=" + this.distance + ", outSR=" + this.outSR + ", outFields=" + this.outFields + "]";
    }

    public int hashCode() {
        SpatialReference spatialReference = this.inSR;
        int hashCode = ((((spatialReference == null ? 0 : spatialReference.hashCode()) + 31) * 31) + this.maxLocations) * 31;
        List<String> list = this.outFields;
        int hashCode2 = (hashCode + (list == null ? 0 : list.hashCode())) * 31;
        SpatialReference spatialReference2 = this.outSR;
        int hashCode3 = (hashCode2 + (spatialReference2 == null ? 0 : spatialReference2.hashCode())) * 31;
        Envelope envelope = this.searchExtent;
        int hashCode4 = (hashCode3 + (envelope == null ? 0 : envelope.hashCode())) * 31;
        String str = this.sourceCountry;
        int hashCode5 = (hashCode4 + (str == null ? 0 : str.hashCode())) * 31;
        String str2 = this.text;
        int hashCode6 = (hashCode5 + (str2 == null ? 0 : str2.hashCode())) * 31;
        Point point = this.location;
        return hashCode6 + (point != null ? point.hashCode() : 0);
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && getClass() == obj.getClass()) {
            LocatorFindParameters locatorFindParameters = (LocatorFindParameters) obj;
            SpatialReference spatialReference = this.inSR;
            if (spatialReference == null) {
                if (locatorFindParameters.inSR != null) {
                    return false;
                }
            } else if (!spatialReference.equals(locatorFindParameters.inSR)) {
                return false;
            }
            if (this.maxLocations != locatorFindParameters.maxLocations) {
                return false;
            }
            List<String> list = this.outFields;
            if (list == null) {
                if (locatorFindParameters.outFields != null) {
                    return false;
                }
            } else if (!list.equals(locatorFindParameters.outFields)) {
                return false;
            }
            SpatialReference spatialReference2 = this.outSR;
            if (spatialReference2 == null) {
                if (locatorFindParameters.outSR != null) {
                    return false;
                }
            } else if (!spatialReference2.equals(locatorFindParameters.outSR)) {
                return false;
            }
            Envelope envelope = this.searchExtent;
            if (envelope == null) {
                if (locatorFindParameters.searchExtent != null) {
                    return false;
                }
            } else if (!envelope.equals(locatorFindParameters.searchExtent)) {
                return false;
            }
            String str = this.sourceCountry;
            if (str == null) {
                if (locatorFindParameters.sourceCountry != null) {
                    return false;
                }
            } else if (!str.equals(locatorFindParameters.sourceCountry)) {
                return false;
            }
            String str2 = this.text;
            if (str2 == null) {
                if (locatorFindParameters.text != null) {
                    return false;
                }
            } else if (!str2.equals(locatorFindParameters.text)) {
                return false;
            }
            Point point = this.location;
            if (point == null) {
                if (locatorFindParameters.location != null) {
                    return false;
                }
            } else if (!point.equals(locatorFindParameters.location)) {
                return false;
            }
            return this.distance == locatorFindParameters.distance;
        }
        return false;
    }
}
